package com.bawei.liliquan1409f20160620;

import java.util.List;

import com.loopj.android.image.SmartImageView;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class NewsAdapter extends BaseAdapter {

	
	Context context;
	public NewsAdapter(Context context, List<News> list) {
		super();
		this.context = context;
		this.list = list;
	}

	List<News> list;
	
	
	
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		 News news=list.get(position);
		View view=View.inflate(context,R.layout.buju,null);
		 SmartImageView amart=(SmartImageView) view.findViewById(R.id.image);
		TextView text1= (TextView) view.findViewById(R.id.text1);
		TextView text2= (TextView) view.findViewById(R.id.text2);
		amart.setImageUrl(news.getCover());
		text1.setText(news.getTitle());
		text2.setText(news.getAct());
		
		return view;
	}

}
